import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "Users")
public class User {
	@Id
	@Column(name= "user_id")
	private Integer user_id;
	
	@Column(name= "type")
	private String type;
	
	@Column(name= "login")
	private String login;
	
	@Column(name= "password")
	private String password;
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	private Student stud;
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_id")
	private Professor prof;
	
	//getters
	
	public Integer getId(){return this.user_id;}
	
	public String getType(){return this.type;}
	
	public String getLogin(){return this.login;}
	
	public String getPassword(){return this.password;}
	
	public Student getStudent(){return this.stud;}
	
	public Professor getProfessor(){return this.prof;}
	
	//setters
	
	public void setId(Integer id){this.user_id=id;}
	
	public void setType(String type){this.type=type;}
	
	public void setLogin(String login){this.login=login;}
	
	public void setPassword(String password){this.password=password;}
	
	public void setStudent(Student stud){this.stud=stud;}
	
	public void setProfessor(Professor prof){this.prof=prof;}
	
}
